package top.suven.base.http.enums;

public enum PlatformEnumType {
    OTHER(-1, "other"),
    ANDROID(1, "android"),
    IOS(2, "ios"),
    PC(3, "win"),
    WIN_ST(4, "win_st"),
    WEB(5, "web"),;

    private final int value;
    private final String key;

    PlatformEnumType(int value, String key) {
        this.value = value;
        this.key = key;
    }

    public int getValue() {
        return value;
    }

    public String getKey() {
        return key;
    }

    public static PlatformEnumType valueOf(int value) {
        switch (value) {
            case 1:
                return ANDROID;
            case 2:
                return IOS;
            case 3:
                return PC;
            case 4:
                return WIN_ST;
            case 5:
                return WEB;
            default:
                return null;
        }
    }

    public static String valueOfString(int value) {
        switch (value) {
            case 1:
                return "android";
            case 2:
                return "ios";
            case 3:
                return "win";
            case 4:
                return "win_st";//云控
            case 5:
                return "web";//官网
            default:
                return null;
        }
    }

    public static boolean containsIndex(int value) {
        return valueOf(value) != null;
    }
}
